﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Omniscient.Foundation.ApplicationModel.Presentation;
using Omniscient.TimeTracker.BusinessModel.Security;

namespace Omniscient.TimeTracker.Security
{
    /// <summary>
    /// Interaction logic for LoginPrompt.xaml
    /// </summary>
    public partial class LoginPrompt : Window
    {
        public UserCredential UserCredential { get; set; }

        public LoginPrompt()
        {
            InitializeComponent();
            ButtonOK.IsEnabled = false;
            UserCredential = null;
            TextBoxUserName.Focus();
        }

        private void ButtonOK_Click(object sender, RoutedEventArgs e)
        {
            UserCredential = new UserCredential() { UserName = TextBoxUserName.Text.Trim(), Password = PasswordBoxPassword.SecurePassword };
            this.Close();
        }

        private void TextBoxUserName_TextChanged(object sender, TextChangedEventArgs e)
        {
            ButtonOK.IsEnabled = !string.IsNullOrEmpty(TextBoxUserName.Text.Trim());
        }

        private void ButtonCancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

    }
}
